import pandas as pd
import numpy as np
#fillna:
#ffill：用上一个观测值来填充
#bfill：用下一个观测值来填充
df = pd.DataFrame([[np.nan, 2, np.nan, 0],
                   [3, 4, np.nan, 1],
                   [np.nan, np.nan, np.nan, 5],
                   [np.nan, 3, np.nan, 4]], columns=list('ABCD'))
print(df)
df['C'].fillna(0, inplace=True)
df['A'].fillna(method='bfill', inplace=True)
print(df)
df.fillna(value={'A':df['C']}, inplace=True)
print(df)